package qreasymarket.movil;

import org.json.JSONArray;
import org.json.JSONObject;

import qreasymarket.movil.controls.Carousel;
import qreasymarket.movil.controls.CarouselAdapter;
import qreasymarket.movil.controls.CarouselAdapter.OnItemClickListener;
import android.app.Activity;
import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.os.Bundle;

import android.view.View.OnClickListener;
import android.view.View;
import android.view.Window;
import android.widget.ImageButton;
import android.widget.Toast;

public class MenuCarrusel extends Activity implements OnClickListener {

	ImageButton  Salirbtn;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		requestWindowFeature(Window.FEATURE_NO_TITLE);

		setContentView(R.layout.inicio);
		Salirbtn = (ImageButton) findViewById(R.id.btnSalir);
		this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

		Carousel carousel = (Carousel) findViewById(R.id.carousel);
		carousel.setOnItemClickListener(new OnItemClickListener() {

			// @Override
			public void onItemClick(CarouselAdapter<?> parent, View view,
					int position, long id) {
				if (position == 0) {
					Intent a = new Intent(MenuCarrusel.this,
							CapturaQRActivity.class);
					startActivity(a);
				}

				else if (position == 1) {
					Intent i = new Intent(MenuCarrusel.this,
							DeliveryActivity.class);
					startActivity(i);
				} else if (position == 2) {
					Intent i = new Intent(MenuCarrusel.this,
							PromocionesActivity.class);
					startActivity(i);
				}else if (position == 3) {
					Intent i = new Intent(MenuCarrusel.this,
							AyudaActivity.class);
					startActivity(i);
				}
				

				else {
					Toast.makeText(MenuCarrusel.this, "Posicion= " + position,
							Toast.LENGTH_LONG).show();
				}
			}

		});

		Salirbtn = (ImageButton) findViewById(R.id.btnSalir);
		Salirbtn.setOnClickListener(this);

	}
	
	public void onClick(View view) {

		if (view == Salirbtn) {
			finish();
			Intent i = new Intent(MenuCarrusel.this,
					LoginClienteActivity.class);
			startActivity(i);
		}
	}
	

}
